﻿Public Class mnuPrincipal

    Private m_frmCajaListado As frmEstadoCaja
    Public Property frmCajaListado() As frmEstadoCaja
        Get
            Return m_frmCajaListado
        End Get
        Set(ByVal value As frmEstadoCaja)
            m_frmCajaListado = value
        End Set
    End Property

    Private m_frmGastosListado As frmComprasGastosListado
    Public Property frmGastosListado() As frmComprasGastosListado
        Get
            Return m_frmGastosListado
        End Get
        Set(ByVal value As frmComprasGastosListado)
            m_frmGastosListado = value
        End Set
    End Property

    Private m_CajaListado As frmCajaListado
    Public Property pCajaListado() As frmCajaListado
        Get
            Return m_CajaListado
        End Get
        Set(ByVal value As frmCajaListado)
            m_CajaListado = value
        End Set
    End Property

    Private m_frmGastos As frmComprasGastos
    Public Property frmGastos() As frmComprasGastos
        Get
            Return m_frmGastos
        End Get
        Set(ByVal value As frmComprasGastos)
            m_frmGastos = value
        End Set
    End Property

    Private m_frmStock As frmStockEstadoCuenta
    Public Property frmStock() As frmStockEstadoCuenta
        Get
            Return m_frmStock
        End Get
        Set(ByVal value As frmStockEstadoCuenta)
            m_frmStock = value
        End Set
    End Property

    Private m_frmLog As frmLog
    Public Property frmLog() As frmLog
        Get
            Return m_frmLog
        End Get
        Set(ByVal value As frmLog)
            m_frmLog = value
        End Set
    End Property

    Private m_frmNotaCredito As frmNotasCredito
    Public Property frmNotaCredito() As frmNotasCredito
        Get
            Return m_frmNotaCredito
        End Get
        Set(ByVal value As frmNotasCredito)
            m_frmNotaCredito = value
        End Set
    End Property

    Private m_frmNotaCreditoListado As frmNotasCreditoListado
    Public Property frmNotaCreditoListado() As frmNotasCreditoListado
        Get
            Return m_frmNotaCreditoListado
        End Get
        Set(ByVal value As frmNotasCreditoListado)
            m_frmNotaCreditoListado = value
        End Set
    End Property

    Private m_frmOrdenPago As frmOrdenPago
    Public Property frmOrdenPagoForm() As frmOrdenPago
        Get
            Return m_frmOrdenPago
        End Get
        Set(ByVal value As frmOrdenPago)
            m_frmOrdenPago = value
        End Set
    End Property

    Private m_frmDevolucion As frmDevolucion
    Public Property frmDevolucionForm() As frmDevolucion
        Get
            Return m_frmDevolucion
        End Get
        Set(ByVal value As frmDevolucion)
            m_frmDevolucion = value
        End Set
    End Property

    Private m_frmOrdenPagoList As frmOrdenPagoListado
    Public Property frmOrdenPagoList() As frmOrdenPagoListado
        Get
            Return m_frmOrdenPagoList
        End Get
        Set(ByVal value As frmOrdenPagoListado)
            m_frmOrdenPagoList = value
        End Set
    End Property

    Private m_frmDevolucionList As frmDevolucionListado
    Public Property frmDevolucionList() As frmDevolucionListado
        Get
            Return m_frmDevolucionList
        End Get
        Set(ByVal value As frmDevolucionListado)
            m_frmDevolucionList = value
        End Set
    End Property

    Private m_frmOrdenCompraList As frmOrdenCompraListado
    Public Property frmOrdenCompraListForm() As frmOrdenCompraListado
        Get
            Return m_frmOrdenCompraList
        End Get
        Set(ByVal value As frmOrdenCompraListado)
            m_frmOrdenCompraList = value
        End Set
    End Property

    Private m_frmOrdenCompra As frmOrdenCompra
    Public Property frmOrdenCompraForm() As frmOrdenCompra
        Get
            Return m_frmOrdenCompra
        End Get
        Set(ByVal value As frmOrdenCompra)
            m_frmOrdenCompra = value
        End Set
    End Property

    Private m_frmListaPrecioLitadoList As frmListaPrecioLitado
    Public Property frmListaPrecioListForm() As frmListaPrecioLitado
        Get
            Return m_frmListaPrecioLitadoList
        End Get
        Set(ByVal value As frmListaPrecioLitado)
            m_frmListaPrecioLitadoList = value
        End Set
    End Property

    Private m_frmListaPrecio As frmListaPrecio
    Public Property frmListaPrecioForm() As frmListaPrecio
        Get
            Return m_frmListaPrecio
        End Get
        Set(ByVal value As frmListaPrecio)
            m_frmListaPrecio = value
        End Set
    End Property

    '-----------------------------------------------------

    Private m_frmMercaLote As frmMercaderiaLote
    Public Property frmMercaLoteForm() As frmMercaderiaLote
        Get
            Return m_frmMercaLote
        End Get
        Set(ByVal value As frmMercaderiaLote)
            m_frmMercaLote = value
        End Set
    End Property

    Private m_frmRecibosList As frmRecibosListado
    Public Property frmRecibosListForm() As frmRecibosListado
        Get
            Return m_frmRecibosList
        End Get
        Set(ByVal value As frmRecibosListado)
            m_frmRecibosList = value
        End Set
    End Property

    Private m_frmRecibos As frmRecibos
    Public Property frmRecibosForm() As frmRecibos
        Get
            Return m_frmRecibos
        End Get
        Set(ByVal value As frmRecibos)
            m_frmRecibos = value
        End Set
    End Property

    Private m_frmVendedores As frmVendedoresListado
    Public Property frmVendedoresForm() As frmVendedoresListado
        Get
            Return m_frmVendedores
        End Get
        Set(ByVal value As frmVendedoresListado)
            m_frmVendedores = value
        End Set
    End Property

    Private m_frmCliente As frmClientesListado
    Public Property frmClienteForm() As frmClientesListado
        Get
            Return m_frmCliente
        End Get
        Set(ByVal value As frmClientesListado)
            m_frmCliente = value
        End Set
    End Property

    Private m_frmRemision As frmNotaRemisionListado
    Public Property frmRemisionForm() As frmNotaRemisionListado
        Get
            Return m_frmRemision
        End Get
        Set(ByVal value As frmNotaRemisionListado)
            m_frmRemision = value
        End Set
    End Property

    Private m_frmComprasListado As frmComprasListado
    Public Property frmComprasListadoForm() As frmComprasListado
        Get
            Return m_frmComprasListado
        End Get
        Set(ByVal value As frmComprasListado)
            m_frmComprasListado = value
        End Set
    End Property

    Private m_frmVentasListado As frmVentasListado
    Public Property frmVentasListadoForm() As frmVentasListado
        Get
            Return m_frmVentasListado
        End Get
        Set(ByVal value As frmVentasListado)
            m_frmVentasListado = value
        End Set
    End Property

    Private m_frmCompras As frmCompras
    Public Property frmComprasForm() As frmCompras
        Get
            Return m_frmCompras
        End Get
        Set(ByVal value As frmCompras)
            m_frmCompras = value
        End Set
    End Property

    Private m_frmVentas As frmVentas
    Public Property frmVentasForm() As frmVentas
        Get
            Return m_frmVentas
        End Get
        Set(ByVal value As frmVentas)
            m_frmVentas = value
        End Set
    End Property

    Private m_frmUsuariosListado As frmUsuarioListado
    Public Property frmUsuariosListado() As frmUsuarioListado
        Get
            Return m_frmUsuariosListado
        End Get
        Set(ByVal value As frmUsuarioListado)
            m_frmUsuariosListado = value
        End Set
    End Property

    Private m_frmProveedoresListado As frmProveedorListado
    Public Property frmProveedoresListado() As frmProveedorListado
        Get
            Return m_frmProveedoresListado
        End Get
        Set(ByVal value As frmProveedorListado)
            m_frmProveedoresListado = value
        End Set
    End Property

    Private m_frmDeposito As frmDepositoListado
    Public Property frmDeposito() As frmDepositoListado
        Get
            Return m_frmDeposito
        End Get
        Set(ByVal value As frmDepositoListado)
            m_frmDeposito = value
        End Set
    End Property

    Private m_frmMarcas As frmMarca
    Public Property frmMarcas() As frmMarca
        Get
            Return m_frmMarcas
        End Get
        Set(ByVal value As frmMarca)
            m_frmMarcas = value
        End Set
    End Property

    Private m_frmRubros As frmRubro
    Public Property frmRubros() As frmRubro
        Get
            Return m_frmRubros
        End Get
        Set(ByVal value As frmRubro)
            m_frmRubros = value
        End Set
    End Property

    Private m_frmImpuestos As frmImpuesto
    Public Property frmImpuestos() As frmImpuesto
        Get
            Return m_frmImpuestos
        End Get
        Set(ByVal value As frmImpuesto)
            m_frmImpuestos = value
        End Set
    End Property

    Private m_frmMercaderiasListado As frmMercaderiaListado
    Public Property frmMercaderiasListado() As frmMercaderiaListado
        Get
            Return m_frmMercaderiasListado
        End Get
        Set(ByVal value As frmMercaderiaListado)
            m_frmMercaderiasListado = value
        End Set
    End Property

    Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
        Application.Exit()

    End Sub

    Private Sub CustomizeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CustomizeToolStripMenuItem.Click
        If m_frmMarcas Is Nothing Then
            m_frmMarcas = New frmMarca()
            m_frmMarcas.MdiParent = Me
            m_frmMarcas.Show()
        Else

            If Not m_frmMarcas.Visible Then
                m_frmMarcas = New frmMarca()
                m_frmMarcas.MdiParent = Me
                m_frmMarcas.Show()
            Else
                m_frmMarcas.Select()
                m_frmMarcas.Activate()
            End If

        End If
    End Sub

    Private Sub OptionsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OptionsToolStripMenuItem.Click
        If m_frmRubros Is Nothing Then
            m_frmRubros = New frmRubro()
            m_frmRubros.MdiParent = Me
            m_frmRubros.Show()
        Else

            If Not m_frmRubros.Visible Then
                m_frmRubros = New frmRubro()
                m_frmRubros.MdiParent = Me
                m_frmRubros.Show()
            Else
                m_frmRubros.Select()
                m_frmRubros.Activate()
            End If

        End If
    End Sub

    Private Sub ImpuestosToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ImpuestosToolStripMenuItem.Click
        If m_frmImpuestos Is Nothing Then
            m_frmImpuestos = New frmImpuesto()
            m_frmImpuestos.MdiParent = Me
            m_frmImpuestos.Show()
        Else

            If Not m_frmImpuestos.Visible Then
                m_frmImpuestos = New frmImpuesto()
                m_frmImpuestos.MdiParent = Me
                m_frmImpuestos.Show()
            Else
                m_frmImpuestos.Select()
                m_frmImpuestos.Activate()
            End If

        End If
    End Sub

    Private Sub MercaderiasToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MercaderiasToolStripMenuItem.Click

        If m_frmMercaderiasListado Is Nothing Then
            m_frmMercaderiasListado = New frmMercaderiaListado()
            m_frmMercaderiasListado.MdiParent = Me
            m_frmMercaderiasListado.Show()
        Else

            If Not m_frmMercaderiasListado.Visible Then
                m_frmMercaderiasListado = New frmMercaderiaListado()
                m_frmMercaderiasListado.MdiParent = Me
                m_frmMercaderiasListado.Show()
            Else
                m_frmMercaderiasListado.Select()
                m_frmMercaderiasListado.Activate()
            End If

        End If

    End Sub

    Private Sub DepositosToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DepositosToolStripMenuItem.Click

        If m_frmDeposito Is Nothing Then
            m_frmDeposito = New frmDepositoListado()
            m_frmDeposito.MdiParent = Me
            m_frmDeposito.Show()
        Else

            If Not m_frmDeposito.Visible Then
                m_frmDeposito = New frmDepositoListado()
                m_frmDeposito.MdiParent = Me
                m_frmDeposito.Show()
            Else
                m_frmDeposito.Select()
                m_frmDeposito.Activate()
            End If

        End If

    End Sub

    Private Sub ProveedoresToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProveedoresToolStripMenuItem.Click

        If m_frmProveedoresListado Is Nothing Then
            m_frmProveedoresListado = New frmProveedorListado()
            m_frmProveedoresListado.MdiParent = Me
            m_frmProveedoresListado.Show()
        Else

            If Not m_frmProveedoresListado.Visible Then
                m_frmProveedoresListado = New frmProveedorListado()
                m_frmProveedoresListado.MdiParent = Me
                m_frmProveedoresListado.Show()
            Else
                m_frmProveedoresListado.Select()
                m_frmProveedoresListado.Activate()
            End If

        End If

    End Sub

    Private Sub UsuariosToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UsuariosToolStripMenuItem.Click

        If m_frmUsuariosListado Is Nothing Then
            m_frmUsuariosListado = New frmUsuarioListado()
            m_frmUsuariosListado.MdiParent = Me
            m_frmUsuariosListado.Show()
        Else

            If Not m_frmUsuariosListado.Visible Then
                m_frmUsuariosListado = New frmUsuarioListado()
                m_frmUsuariosListado.MdiParent = Me
                m_frmUsuariosListado.Show()
            Else
                m_frmUsuariosListado.Select()
                m_frmUsuariosListado.Activate()
            End If

        End If

    End Sub

    Private Sub mnuPrincipal_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim cultureInfo As New System.Globalization.CultureInfo("es-PY")
        Application.CurrentCulture = cultureInfo
        Application.EnableVisualStyles()
        'Application.SetCompatibleTextRenderingDefault(False)

        Dim login As New frmLogin
        If login.ShowDialog() = Windows.Forms.DialogResult.OK Then
            toolStripMenu.Text = "Bienvenido " & oiml.UsuarioNombre
            'ControlPermisos()

            If oiml.idTipoUsuario = "C" Then
                CajaToolStripMenuItem.Visible = True
                OperacionesToolStripMenuItem.Visible = False
                MantenimientoStripMenuItem.Visible = False
                StockToolStripMenuItem.Visible = False
            ElseIf oiml.idTipoUsuario = "V" Then
                CajaToolStripMenuItem.Visible = False
                OperacionesToolStripMenuItem.Visible = True
                MantenimientoStripMenuItem.Visible = False
                StockToolStripMenuItem.Visible = False
            ElseIf oiml.idTipoUsuario = "S" Then
                CajaToolStripMenuItem.Visible = False
                OperacionesToolStripMenuItem.Visible = False
                MantenimientoStripMenuItem.Visible = False
                StockToolStripMenuItem.Visible = True
            ElseIf oiml.idTipoUsuario = "A" Then
                CajaToolStripMenuItem.Visible = True
                OperacionesToolStripMenuItem.Visible = True
                MantenimientoStripMenuItem.Visible = True
                StockToolStripMenuItem.Visible = True
            End If

        Else
            Application.Exit()

        End If

    End Sub

    Private Sub ComprasToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComprasToolStripMenuItem.Click

        If frmComprasForm Is Nothing Then
            frmComprasForm = New frmCompras()
            frmComprasForm.MdiParent = Me
            frmComprasForm.Show()
        Else

            If Not frmComprasForm.Visible Then
                frmComprasForm = New frmCompras()
                frmComprasForm.MdiParent = Me
                frmComprasForm.Show()
            Else
                frmComprasForm.Select()
                frmComprasForm.Activate()
            End If

        End If

    End Sub

    Private Sub ComprasListadoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComprasListadoToolStripMenuItem.Click

        If frmComprasListadoForm Is Nothing Then
            frmComprasListadoForm = New frmComprasListado()
            frmComprasListadoForm.MdiParent = Me
            frmComprasListadoForm.Show()
        Else

            If Not frmComprasListadoForm.Visible Then
                frmComprasListadoForm = New frmComprasListado()
                frmComprasListadoForm.MdiParent = Me
                frmComprasListadoForm.Show()
            Else
                frmComprasListadoForm.Select()
                frmComprasListadoForm.Activate()
            End If

        End If

    End Sub

    Private Sub RemisionesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub ClientesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClientesToolStripMenuItem.Click
        If m_frmCliente Is Nothing Then
            m_frmCliente = New frmClientesListado()
            m_frmCliente.MdiParent = Me
            m_frmCliente.Show()
        Else

            If Not m_frmCliente.Visible Then
                m_frmCliente = New frmClientesListado()
                m_frmCliente.MdiParent = Me
                m_frmCliente.Show()
            Else
                m_frmCliente.Select()
                m_frmCliente.Activate()
            End If

        End If
    End Sub

    Private Sub VentasToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VentasToolStripMenuItem.Click

        If frmVentasForm Is Nothing Then
            frmVentasForm = New frmVentas()
            frmVentasForm.MdiParent = Me
            frmVentasForm.Show()
        Else

            If Not frmVentasForm.Visible Then
                frmVentasForm = New frmVentas()
                frmVentasForm.MdiParent = Me
                frmVentasForm.Show()
            Else
                frmVentasForm.Select()
                frmVentasForm.Activate()
            End If

        End If

    End Sub

    Private Sub VentasListadoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VentasListadoToolStripMenuItem.Click

        If frmVentasListadoForm Is Nothing Then
            frmVentasListadoForm = New frmVentasListado()
            frmVentasListadoForm.MdiParent = Me
            frmVentasListadoForm.Show()
        Else

            If Not frmVentasListadoForm.Visible Then
                frmVentasListadoForm = New frmVentasListado()
                frmVentasListadoForm.MdiParent = Me
                frmVentasListadoForm.Show()
            Else
                frmVentasListadoForm.Select()
                frmVentasListadoForm.Activate()
            End If

        End If

    End Sub

    Private Sub VendedoresToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VendedoresToolStripMenuItem.Click

        If frmVendedoresForm Is Nothing Then
            frmVendedoresForm = New frmVendedoresListado
            frmVendedoresForm.MdiParent = Me
            frmVendedoresForm.Show()
        Else

            If Not frmVendedoresForm.Visible Then
                frmVendedoresForm = New frmVendedoresListado()
                frmVendedoresForm.MdiParent = Me
                frmVendedoresForm.Show()
            Else
                frmVendedoresForm.Select()
                frmVendedoresForm.Activate()
            End If

        End If

    End Sub

    Private Sub RecibosToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


    End Sub

    Private Sub RecibosListadoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)



    End Sub

    Private Sub StockInventarioToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


    End Sub

    Private Sub ListaDePreciosToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


    End Sub

    Private Sub OrdenDeCompraToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OrdenDeCompraToolStripMenuItem.Click

        If frmOrdenCompraForm Is Nothing Then
            frmOrdenCompraForm = New frmOrdenCompra
            frmOrdenCompraForm.MdiParent = Me
            frmOrdenCompraForm.Show()
        Else

            If Not frmOrdenCompraForm.Visible Then
                frmOrdenCompraForm = New frmOrdenCompra
                frmOrdenCompraForm.MdiParent = Me
                frmOrdenCompraForm.Show()
            Else
                frmOrdenCompraForm.Select()
                frmOrdenCompraForm.Activate()
            End If

        End If

    End Sub

    Private Sub OrdenDeCompraListadoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OrdenDeCompraListadoToolStripMenuItem.Click

        If frmOrdenCompraListForm Is Nothing Then
            frmOrdenCompraListForm = New frmOrdenCompraListado
            frmOrdenCompraListForm.MdiParent = Me
            frmOrdenCompraListForm.Show()
        Else

            If Not frmOrdenCompraListForm.Visible Then
                frmOrdenCompraListForm = New frmOrdenCompraListado
                frmOrdenCompraListForm.MdiParent = Me
                frmOrdenCompraListForm.Show()
            Else
                frmOrdenCompraListForm.Select()
                frmOrdenCompraListForm.Activate()
            End If

        End If

    End Sub

    Private Sub DevolucionesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


    End Sub

    Private Sub DevolucionesListadoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

    Private Sub OrdenDePagoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        If frmOrdenPagoForm Is Nothing Then
            frmOrdenPagoForm = New frmOrdenPago
            frmOrdenPagoForm.MdiParent = Me
            frmOrdenPagoForm.Show()
        Else

            If Not frmOrdenPagoForm.Visible Then
                frmOrdenPagoForm = New frmOrdenPago
                frmOrdenPagoForm.MdiParent = Me
                frmOrdenPagoForm.Show()
            Else
                frmOrdenPagoForm.Select()
                frmOrdenPagoForm.Activate()
            End If

        End If


    End Sub

    Private Sub OrdenDepagoListadoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)



    End Sub

    Private Sub ToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem2.Click

        If frmNotaCredito Is Nothing Then
            frmNotaCredito = New frmNotasCredito
            frmNotaCredito.MdiParent = Me
            frmNotaCredito.Show()
        Else

            If Not frmNotaCredito.Visible Then
                frmNotaCredito = New frmNotasCredito
                frmNotaCredito.MdiParent = Me
                frmNotaCredito.Show()
            Else
                frmNotaCredito.Select()
                frmNotaCredito.Activate()
            End If

        End If

    End Sub

    Private Sub NotasDeCreditoListadoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NotasDeCreditoListadoToolStripMenuItem.Click

        If frmNotaCreditoListado Is Nothing Then
            frmNotaCreditoListado = New frmNotasCreditoListado
            frmNotaCreditoListado.MdiParent = Me
            frmNotaCreditoListado.Show()
        Else

            If Not frmNotaCreditoListado.Visible Then
                frmNotaCreditoListado = New frmNotasCreditoListado
                frmNotaCreditoListado.MdiParent = Me
                frmNotaCreditoListado.Show()
            Else
                frmNotaCreditoListado.Select()
                frmNotaCreditoListado.Activate()
            End If

        End If

    End Sub

    Private Sub LogAuditoriaDatosToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LogAuditoriaDatosToolStripMenuItem.Click

        If frmLog Is Nothing Then
            frmLog = New frmLog
            frmLog.MdiParent = Me
            frmLog.Show()
        Else

            If Not frmLog.Visible Then
                frmLog = New frmLog
                frmLog.MdiParent = Me
                frmLog.Show()
            Else
                frmLog.Select()
                frmLog.Activate()
            End If

        End If

    End Sub

    Private Sub MovimientoDeStockToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MovimientoDeStockToolStripMenuItem.Click

        If frmStock Is Nothing Then
            frmStock = New frmStockEstadoCuenta
            frmStock.MdiParent = Me
            frmStock.Show()
        Else

            If Not frmStock.Visible Then
                frmStock = New frmStockEstadoCuenta
                frmStock.MdiParent = Me
                frmStock.Show()
            Else
                frmStock.Select()
                frmStock.Activate()
            End If

        End If

    End Sub

    Private Sub RegistroDeGastosVariosToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)



    End Sub

    Private Sub GastosVariosListadoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)



    End Sub

    Private Sub RegistroDeIngresosVariosToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

        If frmGastos Is Nothing Then
            frmGastos = New frmComprasGastos
            frmGastos.codTipoParam = "INGRESOS"
            frmGastos.MdiParent = Me
            frmGastos.Show()
        Else

            If Not frmGastos.Visible Then
                frmGastos = New frmComprasGastos
                frmGastos.codTipoParam = "INGRESOS"
                frmGastos.MdiParent = Me
                frmGastos.Show()
            Else
                frmGastos.codTipoParam = "INGRESOS"
                frmGastos.Select()
                frmGastos.Activate()
            End If

        End If

    End Sub

    Private Sub ReporteDeMovimientosToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)



    End Sub

    Private Sub CajaIngresosYEgresosToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CajaIngresosYEgresosToolStripMenuItem.Click
        If frmGastos Is Nothing Then
            frmGastos = New frmComprasGastos
            frmGastos.codTipoParam = "EGRESOS"
            frmGastos.MdiParent = Me
            frmGastos.Show()
        Else

            If Not frmGastos.Visible Then
                frmGastos = New frmComprasGastos
                frmGastos.codTipoParam = "EGRESOS"
                frmGastos.MdiParent = Me
                frmGastos.Show()
            Else
                frmGastos.codTipoParam = "EGRESOS"
                frmGastos.Select()
                frmGastos.Activate()
            End If

        End If
    End Sub

    Private Sub ListadoDeOperacionesToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListadoDeOperacionesToolStripMenuItem.Click
        If pCajaListado Is Nothing Then
            pCajaListado = New frmCajaListado
            pCajaListado.MdiParent = Me
            pCajaListado.Show()
        Else

            If Not pCajaListado.Visible Then
                pCajaListado = New frmCajaListado
                pCajaListado.MdiParent = Me
                pCajaListado.Show()
            Else
                pCajaListado.Select()
                pCajaListado.Activate()
            End If

        End If
    End Sub

    Private Sub ReporteDeMovimientosToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ReporteDeMovimientosToolStripMenuItem1.Click
        If frmCajaListado Is Nothing Then
            frmCajaListado = New frmEstadoCaja
            frmCajaListado.MdiParent = Me
            frmCajaListado.Show()
        Else

            If Not frmCajaListado.Visible Then
                frmCajaListado = New frmEstadoCaja
                frmCajaListado.MdiParent = Me
                frmCajaListado.Show()
            Else
                frmCajaListado.Select()
                frmCajaListado.Activate()
            End If

        End If
    End Sub

    Private Sub ListadoDeRecibosToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListadoDeRecibosToolStripMenuItem.Click
        If frmRecibosListForm Is Nothing Then
            frmRecibosListForm = New frmRecibosListado
            frmRecibosListForm.MdiParent = Me
            frmRecibosListForm.Show()
        Else

            If Not frmRecibosListForm.Visible Then
                frmRecibosListForm = New frmRecibosListado()
                frmRecibosListForm.MdiParent = Me
                frmRecibosListForm.Show()
            Else
                frmRecibosListForm.Select()
                frmRecibosListForm.Activate()
            End If

        End If
    End Sub

    Private Sub RegistroDeRecibosToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RegistroDeRecibosToolStripMenuItem.Click
        If frmRecibosForm Is Nothing Then
            frmRecibosForm = New frmRecibos
            frmRecibosForm.MdiParent = Me
            frmRecibosForm.Show()
        Else

            If Not frmRecibosForm.Visible Then
                frmRecibosForm = New frmRecibos()
                frmRecibosForm.MdiParent = Me
                frmRecibosForm.Show()
            Else
                frmRecibosForm.Select()
                frmRecibosForm.Activate()
            End If

        End If

    End Sub

    Private Sub ListadoDeOrdenesDePagoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListadoDeOrdenesDePagoToolStripMenuItem.Click
        If frmOrdenPagoList Is Nothing Then
            frmOrdenPagoList = New frmOrdenPagoListado
            frmOrdenPagoList.MdiParent = Me
            frmOrdenPagoList.Show()
        Else

            If Not frmOrdenPagoList.Visible Then
                frmOrdenPagoList = New frmOrdenPagoListado
                frmOrdenPagoList.MdiParent = Me
                frmOrdenPagoList.Show()
            Else
                frmOrdenPagoList.Select()
                frmOrdenPagoList.Activate()
            End If

        End If
    End Sub

    Private Sub RegistroDeOrdenesDePagoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RegistroDeOrdenesDePagoToolStripMenuItem.Click
        If frmOrdenPagoForm Is Nothing Then
            frmOrdenPagoForm = New frmOrdenPago
            frmOrdenPagoForm.MdiParent = Me
            frmOrdenPagoForm.Show()
        Else

            If Not frmOrdenPagoForm.Visible Then
                frmOrdenPagoForm = New frmOrdenPago
                frmOrdenPagoForm.MdiParent = Me
                frmOrdenPagoForm.Show()
            Else
                frmOrdenPagoForm.Select()
                frmOrdenPagoForm.Activate()
            End If

        End If
    End Sub

    Private Sub ClientesToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClientesToolStripMenuItem1.Click
        If m_frmCliente Is Nothing Then
            m_frmCliente = New frmClientesListado()
            m_frmCliente.MdiParent = Me
            m_frmCliente.Show()
        Else

            If Not m_frmCliente.Visible Then
                m_frmCliente = New frmClientesListado()
                m_frmCliente.MdiParent = Me
                m_frmCliente.Show()
            Else
                m_frmCliente.Select()
                m_frmCliente.Activate()
            End If

        End If
    End Sub

    Private Sub ProveedoresToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProveedoresToolStripMenuItem1.Click
        If m_frmProveedoresListado Is Nothing Then
            m_frmProveedoresListado = New frmProveedorListado()
            m_frmProveedoresListado.MdiParent = Me
            m_frmProveedoresListado.Show()
        Else

            If Not m_frmProveedoresListado.Visible Then
                m_frmProveedoresListado = New frmProveedorListado()
                m_frmProveedoresListado.MdiParent = Me
                m_frmProveedoresListado.Show()
            Else
                m_frmProveedoresListado.Select()
                m_frmProveedoresListado.Activate()
            End If

        End If
    End Sub

    Private Sub DevolucionesListadoToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DevolucionesListadoToolStripMenuItem1.Click

        If frmDevolucionList Is Nothing Then
            frmDevolucionList = New frmDevolucionListado
            frmDevolucionList.MdiParent = Me
            frmDevolucionList.Show()
        Else

            If Not frmDevolucionList.Visible Then
                frmDevolucionList = New frmDevolucionListado
                frmDevolucionList.MdiParent = Me
                frmDevolucionList.Show()
            Else
                frmDevolucionList.Select()
                frmDevolucionList.Activate()
            End If

        End If

    End Sub

    Private Sub DevolucionesToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DevolucionesToolStripMenuItem1.Click
        If frmDevolucionForm Is Nothing Then
            frmDevolucionForm = New frmDevolucion
            frmDevolucionForm.MdiParent = Me
            frmDevolucionForm.Show()
        Else

            If Not frmDevolucionForm.Visible Then
                frmDevolucionForm = New frmDevolucion
                frmDevolucionForm.MdiParent = Me
                frmDevolucionForm.Show()
            Else
                frmDevolucionForm.Select()
                frmDevolucionForm.Activate()
            End If

        End If

    End Sub

    Private Sub RemisionesToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RemisionesToolStripMenuItem1.Click
        If frmRemisionForm Is Nothing Then
            frmRemisionForm = New frmNotaRemisionListado()
            frmRemisionForm.MdiParent = Me
            frmRemisionForm.Show()
        Else

            If Not frmRemisionForm.Visible Then
                frmRemisionForm = New frmNotaRemisionListado()
                frmRemisionForm.MdiParent = Me
                frmRemisionForm.Show()
            Else
                frmRemisionForm.Select()
                frmRemisionForm.Activate()
            End If

        End If
    End Sub

    Private Sub ListaDepreciosToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListaDepreciosToolStripMenuItem1.Click
        If frmListaPrecioListForm Is Nothing Then
            frmListaPrecioListForm = New frmListaPrecioLitado
            frmListaPrecioListForm.MdiParent = Me
            frmListaPrecioListForm.Show()
        Else

            If Not frmListaPrecioListForm.Visible Then
                frmListaPrecioListForm = New frmListaPrecioLitado()
                frmListaPrecioListForm.MdiParent = Me
                frmListaPrecioListForm.Show()
            Else
                frmListaPrecioListForm.Select()
                frmListaPrecioListForm.Activate()
            End If

        End If

    End Sub

    Private Sub StockInventarioToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StockInventarioToolStripMenuItem1.Click
        If frmMercaLoteForm Is Nothing Then
            frmMercaLoteForm = New frmMercaderiaLote
            frmMercaLoteForm.MdiParent = Me
            frmMercaLoteForm.Show()
        Else

            If Not frmMercaLoteForm.Visible Then
                frmMercaLoteForm = New frmMercaderiaLote()
                frmMercaLoteForm.MdiParent = Me
                frmMercaLoteForm.Show()
            Else
                frmMercaLoteForm.Select()
                frmMercaLoteForm.Activate()
            End If

        End If

    End Sub

    Private Sub CambiarDeSesionToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CambiarDeSesionToolStripMenuItem.Click
        Dim login As New frmLogin
        If login.ShowDialog() = Windows.Forms.DialogResult.OK Then
            toolStripMenu.Text = "Bienvenido " & oiml.UsuarioNombre
            'ControlPermisos()

            If oiml.idTipoUsuario = "C" Then
                CajaToolStripMenuItem.Visible = True
                OperacionesToolStripMenuItem.Visible = False
                MantenimientoStripMenuItem.Visible = False
                StockToolStripMenuItem.Visible = False
            ElseIf oiml.idTipoUsuario = "V" Then
                CajaToolStripMenuItem.Visible = False
                OperacionesToolStripMenuItem.Visible = True
                MantenimientoStripMenuItem.Visible = False
                StockToolStripMenuItem.Visible = False
            ElseIf oiml.idTipoUsuario = "S" Then
                CajaToolStripMenuItem.Visible = False
                OperacionesToolStripMenuItem.Visible = False
                MantenimientoStripMenuItem.Visible = False
                StockToolStripMenuItem.Visible = True
            ElseIf oiml.idTipoUsuario = "A" Then
                CajaToolStripMenuItem.Visible = True
                OperacionesToolStripMenuItem.Visible = True
                MantenimientoStripMenuItem.Visible = True
                StockToolStripMenuItem.Visible = True
            End If

        Else
            Application.Exit()

        End If
    End Sub
End Class